<template>
  <div class="app-container">
    <el-row>
      <el-col :span="23" :offset="1" style="margin-bottom: 10px;margin-top: 10px;">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/loginLog' }" class="bread"><i class="el-icon-location-outline"></i>日志管理</el-breadcrumb-item>
          <el-breadcrumb-item :to="{ path: '/loginLog' }" class="bread">登入日志管理</el-breadcrumb-item>
        </el-breadcrumb>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="7" :offset="17">
        <el-form :model="queryParams" ref="queryForm" size="mini" :inline="true" v-show="showSearch">
          <el-form-item prop="menuName">
            <el-input
                class="inputem"
                v-model="queryParams.userName"
                placeholder="请输入用户名"
                clearable
                @keyup.enter.native="handleQuery"/>
          </el-form-item>
          <el-form-item>
            <el-button icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>

    <el-row type="flex" justify="center">
      <el-col :span="22">
        <div class="mytable">
          <el-table height="510" stripe :data="loginLogList" class="tabletab" header-cell-class-name="table_header">
            <el-table-column
                type="selection"
                width="55">
            </el-table-column>
            <el-table-column label="用户名" prop="userName"></el-table-column>
            <el-table-column label="ip地址" prop="ipaddr"></el-table-column>
            <el-table-column label="登入终端" prop="os"></el-table-column>
            <el-table-column label="结果" prop="status">
              <template slot-scope="scope">
                {{scope.row.status==0?"登入成功":"登入失败"}}
              </template>
            </el-table-column>
            <el-table-column label="登入时间" prop="loginTime"></el-table-column>
<!--           -->
          </el-table>
        </div>
      </el-col>
    </el-row>
    <el-row>
      <el-col :span="8" :offset="15">
        <div class="block" >
          <pagination
              class="pager"
              v-show="total>0"
              :total="total"
              :page.sync="queryParams.pageNum"
              :limit.sync="queryParams.pageSize"
              @pagination="getList"
          />
        </div>
      </el-col>
    </el-row>


    <!-- 添加或修改菜单对话框 -->
<!--    <el-dialog :title="title" :visible.sync="open" width="740px" append-to-body>-->
<!--      <el-form ref="form" :model="form" :rules="rules" label-width="100px">-->
<!--        <el-row>-->
<!--          <el-col :span="24" v-if="form.parentName != '-1'">-->
<!--            <el-form-item label="上级菜单" prop="parentName">-->
<!--              <el-input v-model="form.parentName"  :disabled="true"/>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="24">-->
<!--            <el-form-item label="菜单类型" prop="menuType">-->
<!--              <el-radio-group v-model="form.menuType">-->
<!--                <el-radio label="C">菜单</el-radio>-->
<!--                <el-radio label="F">按钮</el-radio>-->
<!--              </el-radio-group>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="菜单名称" prop="menuName">-->
<!--              <el-input v-model="form.menuName" placeholder="请输入菜单名称" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12">-->
<!--            <el-form-item label="显示排序" prop="orderNum">-->
<!--              <el-input-number v-model="form.orderNum" controls-position="right" type="number" :min="0" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12" v-if="form.menuType == 'C'">-->
<!--            <el-form-item prop="component">-->
<!--              <span slot="label">-->
<!--                <el-tooltip content="访问的组件路径，如：`system/user/index`，默认在`views`目录下" placement="top">-->
<!--                <i class="el-icon-question"></i>-->
<!--                </el-tooltip>-->
<!--                组件路径</span>-->
<!--              <el-input v-model="form.url" placeholder="请输入组件路径" />-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12" v-if="form.menuType != 'M'">-->
<!--            <el-form-item prop="perms">-->
<!--              <el-input v-model="form.menuCode" placeholder="请输入权限标识" maxlength="100" />-->
<!--              <span slot="label">-->
<!--                <el-tooltip content="控制器中定义的权限字符，如：@PreAuthorize(`@ss.hasPermi('system:user:list')`)" placement="top">-->
<!--                <i class="el-icon-question"></i>-->
<!--                </el-tooltip>-->
<!--                权限字符-->
<!--              </span>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--          <el-col :span="12" v-if="form.menuType != 'F'">-->
<!--            <el-form-item prop="status">-->
<!--              <span slot="label">-->
<!--                <el-tooltip content="选择停用则路由将不会出现在侧边栏，也不能被访问" placement="top">-->
<!--                <i class="el-icon-question"></i>-->
<!--                </el-tooltip>-->
<!--                菜单状态-->
<!--              </span>-->
<!--              <el-radio-group v-model="form.visible">-->
<!--                <el-radio :label="0">显示</el-radio>-->
<!--                <el-radio :label="1">不显示</el-radio>-->
<!--              </el-radio-group>-->
<!--            </el-form-item>-->
<!--          </el-col>-->
<!--        </el-row>-->
<!--      </el-form>-->
<!--      <div slot="footer" class="dialog-footer">-->
<!--        <el-button type="primary" @click="submitForm">确 定</el-button>-->
<!--        <el-button @click="cancel">取 消</el-button>-->
<!--      </div>-->
<!--    </el-dialog>-->
  </div>
</template>

<script>
import { listMenu, getMenu, delMenu, addMenu, updateMenu } from "@/api//menu/menu";
import {loginLogList} from "@/api/log/log";

export default {
  name: "loginLog",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 登入日志数据
      loginLogList: [],

      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否展开，默认全部折叠
      isExpandAll: false,
      // 重新渲染表格状态
      refreshTable: true,
      // 查询参数
      queryParams: {
        pageSize:10,
        pageNum:1,
        userName: undefined,
        status: undefined
      },
      total:0,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        menuName: [
          {required: true, message: "菜单名称不能为空", trigger: "blur"}
        ],
        orderNum: [
          {required: true, message: "菜单顺序不能为空", trigger: "blur"}
        ],
        path: [
          {required: true, message: "路由地址不能为空", trigger: "blur"}
        ]
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    // 选择图标
    selected(name) {
      this.form.icon = name;
    },
    /** 查询菜单列表 */
    getList() {
      this.loading = true;
      let data={
        "pageSize": this.queryParams.pageSize,
        "pageNum": this.queryParams.pageNum,
        "userName":this.queryParams.userName
      }
      loginLogList(data).then(res=>{
          this.loginLogList = res.rows
          this.loading = false;
          this.total = res.total
      })
    },
    // 表单重置
    /** 搜索按钮操作 */
    handleQuery() {
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams = {
        pageSize:10,
        pageNum:1
      }
      this.handleQuery();
    },
    // /** 删除按钮操作 */
    // handleDelete(row) {
    //   console.log(row)
    //   this.$model.confirm('是否确认删除名称为"' + row.menuName + '"的数据项？').then(function () {
    //     return delMenu(row.menuId);
    //   }).then(() => {
    //     this.getList();
    //     this.$model.msgSuccess("删除成功");
    //   }).catch(() => {
    //   });
    // }
  }
};
</script>

<style scoped>
.bread /deep/ .el-breadcrumb__inner{
  color: #000000;
}
.bread /deep/ .el-breadcrumb__inner:hover{color: #000000;}
.el-button{
  background-color: #4686D0;
  color: #ffffff;
  border: #4686D0;
  font-size: 12px;
  font-family: "微软雅黑";
}
.el-row{
  margin-top: 20px;
  margin-bottom:20px;
}
.el-input{
  width:250px;
}
.inputem /deep/ .el-input__inner {
  background-color: rgba(0, 0, 0, 0) ;
  border:1px solid #B1B4C5;
}
.inputem /deep/ .el-input__inner:focus{
  border:2px solid #4c87c2;
}
.inputem /deep/ .el-input__inner:hover{
  border:2px solid #4c87c2;
}

.inputem /deep/ .el-input-group__append{
  background-color: #265389;
  border:1px solid #265389;
}
.el-icon-search{
  color: #ffffff;
}
/* .tabletab /deep/ .el-table__header-wrapper{
  background-color: #131627;
  font-family: "微软雅黑";
  font-size: 14px;
} */


/*.tabletab /deep/ .el-table__row{*/
/*  background-color: #131627;*/
/*  font-family: "微软雅黑";*/
/*  font-size: 14px;*/
/*}*/

/*.tabletab /deep/ .el-table__body-wrapper{*/
/*  background-color: #131627;*/
/*  font-family: "微软雅黑";*/
/*  font-size: 14px;*/
/*}*/

/* .el-table::before {
	 left: 0;
	 bottom: 0;

	 height: 0px;
} */

/*::v-deep .cell{*/
/*  color:#ffffff;*/
/*}*/
/*::v-deep.el-table tbody tr:hover > td {*/
/*  background-color: #2b3b5256 !important;*/

/*}*/
/*.tabletab /deep/ .table_header{*/
/*  background-color: #2b3b52 !important;*/
/*}*/
/*.mytable /deep/ .el-table__row>td{*/
/*  !* 去除表格线 *!*/
/*  border-bottom:1px solid #2B3B52;*/
/*}*/
/*.mytable /deep/ .el-table th.is-leaf {*/
/*  !* 去除上边框 *!*/
/*  border: none;*/
/*}*/

/*::v-deep .el-table::before{*/
/*  !* 去除下边框 *!*/
/*  !* height: 0; *!*/
/*  background-color: #2B3B52;*/
/*  !* height: 2px; *!*/
/*}*/
/*.mytable /deep/ .el-table th.el-table__cell{*/
/*  background-color: #2b3b52;*/
/*}*/
</style>
